home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume90
/
util
/
ntscboot
/
NTSCboot.asm
next >
Wrap
Assembly Source File
|
1990-03-15
|
3KB
|
70 lines
X;
X; NTSCBoot.asm
X;
X; Copyright (C) 1990 By Udi Finkelstein.
X; 17 feb 1990
X;
X; Reboot a SuperAgnus equipped PAL machine into NTSC mode.
X;
X; With thanks to Bart Whitebrook from CBM for his article on the new ECS
X; registers in the 3rd european DevCon notes!
X
X; get into supervisor state, since we can only execute RESET there.
X xref _LVOSuperState
X move.l 4,a6
X jsr _LVOSuperState(a6)
X
X; ************************************
X; Warning!!! a grand hack ahead!!!!!!!
X; Never do this stuff alone at home!!!
X; ************************************
X
X; Now we are in supervisor mode, and can issue a RESET command.
X; Unfortunately, after RESET there is no RAM in the system!
X; We can issue exacly *one* instruction ( 1 word length ) because
X; the instruction was fetched before RESET was executed. This
X; instruction can be a 'jmp (aX)', to somewhere on the ROM, where the
X; program can continue. After searching the Kickstart 1.3 ROM, I found
X; that at address $ff4120 you can find the code:
X
X; [ Notice - for Kickstart 1.3 ***ONLY***!!! Is there anybody out there
X; with a Kickstart 1.2/super Agnus combination? you have a problem! ;-) ]
X
X;00FF4120 2741 0038 move.l d1,$38(a3)
X;00FF4124 4281 clr.l d1
X;00FF4126 4ED6 jmp (a6)
X
X; We can use this code fragment to set the NTSC bit in the super agnus,
X; and then jump to the reset code. The PAL/NTSC bit is contained in
X; address $DFF1DC (BEAMCON0 !).
X;
X; 'move.l d1,$38(a3)' writes a longword, therefor $38(a3) must point to
X; $dff1da because it's a read only location, which we can't harm, and
X; $dff1dc contains the PAL/NTSC bit.
X; $38(a3) == $dff1da --> a3 == $ddf1a2
X; we must reset d1 ofcourse, or set d1 == #$00000020 to set PAL mode.
X;
X; ofcourse we have to set a6 to $00000002 to run the reset code later.
X;
X
XROMADR = ($ff4120-$fc0000)
X
X; ROMADR points to $ff4120 after the ROM appears in address $0000.
X
X lea.l $dff1a2,a3
X move.l #$0,d1
X move.l 2,a6
X cnop 0,4
X lea.l ROMADR,a5
X RESET ;reset the machine...
X jmp (a5) ;execute our code fragment.
X
X; Well, that's it. I tried writing a more portable code by trying to
X; set/reset the OVL bit in $BFE001 instead of 'jmp (aX)' after RESET,
X; but I wasn't able to get it working, so the only way I found to run
X; a code after RESET is to find a ROM fragment that happenes to match
X; my requirement. You don't have to tell me how bad it is. Hopefully,
X; the 1.4 preferences will have a PAL/NTSC software switch ( Will it?!!)
X
X END